import request from "@/utils/request";

// 查询活动列表
export function listActive(query) {
  return request({
    url: "/activity/list",
    method: "post",
    data: query,
  });
}

// 新增活动
export function addActive(data) {
  return request({
    url: "/activity/add",
    method: "post",
    data: data,
  });
}

// 修改活动
export function editActive(data) {
  return request({
    url: "/activity/edit",
    method: "post",
    data: data,
  });
}

// 删除活动
export function removeActive(activityId) {
  return request({
    url: "/activity/remove",
    method: "post",
    data: { activityId },
  });
}

// 根据code查询活动状态
export function getStatusByCode(code) {
  return request({
    url: "/activity/getStatusByCode",
    method: "get",
    params: { code },
  });
}

// 修改活动状态
export function editStatus(activityId, targetStatus) {
  return request({
    url: "/activity/editStatus",
    method: "post",
    data: {
      activityId,
      targetStatus, // true 表示开启，false 表示关闭
    },
  });
}
